package com.supergzt.exception;


import com.supergzt.enums.HttpEnum;

import java.io.Serial;

/**
 * 业务异常
 *
 * @author ruoyi
 */
public class ServiceException extends RuntimeException {
	@Serial
	private static final long serialVersionUID = 1L;

	/**
	 * 错误码
	 */
	private Integer code;

	/**
	 * 错误提示
	 */
	private String message;

	/**
	 * 错误明细，内部调试错误
	 */
	private String detailMessage;

	/**
	 * 空构造方法，避免反序列化问题
	 */
	public ServiceException() {
		this.code = HttpEnum.FAIL.getCode();
	}

	public ServiceException(String message) {
		this.code = HttpEnum.FAIL.getCode();
		this.message = message;
	}
	public String getDetailMessage() {
		return detailMessage;
	}

	@Override
	public String getMessage() {
		return message;
	}

	public Integer getCode() {
		return code;
	}

	public ServiceException setMessage(String message) {
		this.message = message;
		return this;
	}

	public ServiceException setDetailMessage(String detailMessage) {
		this.detailMessage = detailMessage;
		return this;
	}
}
